home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
pstui100.zip
/
DEMO1.PAS
next >
Wrap
Pascal/Delphi Source File
|
1993-05-01
|
20KB
|
526 lines
{
╔══════════════════╗
║ PTUI Demo ║
║ ║
║ Rev. 1.00 ║
╚══════════════════╝
}
Program Demo;
{$F-} {$O-} {$A+} {$G-}
{$V-} {$B-} {$X-} {$N+} {$E+}
{$I FINAL.PAS}
{$IFDEF FINAL}
{$I-} {$R-}
{$IFDEF VER70}
{$Q-} {$P-}
{$ENDIF}
{$D-} {$L-} {$S-}
{$M 8192,262144,655360}
{$ELSE}
{$M 8192,0,655360}
{$ENDIF}
Uses CRT,Strings,PTUI,PTUIVCRT,KeyDef;
Procedure BusyExample;
Var
Pop :TextWindow;
X :Word;
Begin
Pop.Open(44,5,72,11,White,LightGrey,Black,Black,NoLine,Solid);
{Open a Window, Solid Colour, No Line}
Pop.NewHeading('Working',CentreText,White,Green);
{Use the heading 'Working', centre the white on green text}
Pop.Lock;
{Use relative coordinates, GotoXY(1,1) is now (44,5)}
VideoColor(White,LightGrey);
GotoXY(10,4);
WriteStr('Not Really');
{Display message in window - Notice, WriteStr instead of Write}
For X:=1 to 366 do {Our scale is 0 to 366}
Begin
Barometer(3,6,25,#219,X,366); {Draw updated barometer}
Delay(10); {Pretend to do something}
End;
Pop.UnLock;
{Must do this - Reset coordinates}
Pop.Close;
{Must do this - release memory from heap}
End;
Var
Win :Array [1..2] of TextWindow; {2 Windows}
WinBut :Array [1..2] of Array [1..7] of Word; {2x7 Buttons}
NewSlide :SlideBarInfo; {A Slide Bar Info}
DelBut,
ActiveWin :Byte;
St :String;
MX,MY :Word;
MB :Byte;
Held,
Doubled,
Special :Boolean;
Key :Char;
SmoothX,
SmoothY :Byte;
TestGet,
Param :String;
Begin
If ParamCount>0 Then
UpperCase(ParamStr(1),Param)
Else
Param:='';
If Pos('?',Param)>0 Then
Begin
WriteLn('Use /C for CGA, /E for EGA or /V for VGA. /V is the default.');
WriteLn('If you have a mono card, this will be detected automatically.');
WriteLn;
WriteLn('If you have a TSeng Super VGA, use /S. Other Super VGA''s: See Docs.');
Halt;
End;
If (Card=ColorCard) Then
Begin
If Pos('/E',Param)>0 Then {EGA?}
Begin
VideoCard[ColorCard].CharacterHeight:=14; {Set Character Size}
EnableVScreen(EGA);
VideoCard[Card].ScrollMethod:=ScrollMethod3; {EGA Scroll}
End;
If (Pos('/V',Param)>0) Or (Param='') Then {VGA?}
EnableVScreen(VGA);
If Pos('/S',Param)>0 Then {SVGA?}
Begin
VideoCard[Card].CardType:=SVGA;
{***********************************************************}
{ Put your SVGA mode number below}
{***********************************************************}
TextMode($26,0,0,0);
{***********************************************************}
EnableVScreen(SVGA);
VideoCard[Card].ScrollMethod:=ScrollMethod2; {SVGA Scroll}
End;
If Pos('/C',Param)=0 Then
SetVirtualScreen(160,70); {Nice big screen}
End;
TestGet:='';
PushCursorSize; {Save the DOS cursor Size}
CursorSize($20,$20); {Kill the cursor (fails on old VGA's)}
Cursor:=False; {Don't update cursor position - save time}
Mouse.Init(True); {Check for a Mouse}
InstallVScreenMouse; {Install Internal Mouse Driver}
TextBackground(Blue);
TextColor(Yellow);
ClrScr; {We've set everything up now, Clear Screen}
GotoXY(2,2);
WriteStr(#7+' Click here to exit or press [Esc] to exit.');
GotoXY(4,3);
WriteStr('Swap between windows with Right Mouse Button or [Tab]. [E] tests the string editor.');
GotoXY(4,4);
WriteStr('Mouse users can drag the window by holding on to the heading and moving the mouse.');
GotoXY(4,5);
WriteStr('Keyboard users (no mouse) can use [Ctrl][F5] and the cursor keys, followed by [Return].');
GotoXY(4,6);
WriteStr('Use the mouse or [Ctrl][PgUp] [PgDn] [Left] [Right] to scroll across the VGA virtual screen.');
Window(40,10,130,30);
WriteStrLn(' ▄▄');
WriteStrLn(' ██████▄ █████████ ██ ██ ██ ██ ▐█▌ ▄████▄ █████▄ █████████');
WriteStrLn(' ▐█▌ ▐█▌ ▐█▌ ▐█▌ ▐█▌ ▐█▌ ██ ██ ██▀ ▀▀ ▐█▌ █▌ ▐█▌');
WriteStrLn(' ██ ▄██ ██ ██ ██ ██ ██ ▐█▌▐█▌ ██ ▄▄█▀ ██');
WriteStrLn(' ██████▀ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██');
WriteStrLn('▐█▌ ▐█▌ ▐█▌ ▐█▌ ▐█▌ ██ ▄██ ██▄ ▄▄ ▐█▌ ██ ▐█▌');
WriteStrLn('██ ██ ▀██████ ██ ████▀ ▀███▀ ██ ▀██ ██');
Window(1,1,VideoCard[Card].XSize,VideoCard[Card].YSize);
SmoothX:=VideoCard[ColorCard].CharacterLength Div 8;
SmoothY:=VideoCard[ColorCard].CharacterHeight Div 8;
{Work out how many pixels to smooth scroll}
DelBut:=1; {Smooth Scroll Temp Variable}
While (DelBut<30) And (Not KeyPressed) do
Begin
Inc(DelBut);
If Not KeyPressed Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*3,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*5,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*7,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
End;
ScreenOrigin((VideoCard[Card].SX1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
{The lazy man's ^KC smooth scroll ;-)}
End;
ScreenOrigin(0,0);
Win[1].Open(10,10,50,20,Yellow,Green,Blue,Magenta,NoLine,Solid);
Win[1].NewHeading('Window 1',CentreText,Yellow,Red);
Win[1].HeadingIcon(True); {Make the heading a button to drag window}
NewSlide.X1:=48;
NewSlide.Y1:=13;
NewSlide.X2:=48; {Setup information for our vertical slide bar}
NewSlide.Y2:=19;
NewSlide.Forg:=Yellow;
NewSlide.Back:=Green;
NewSlide.MainChar:='░';
NewSlide.ButtonChar:='▓';
NewSlide.UpLeftChar:=#$18;
NewSlide.DownRightChar:=#$19;
NewSlide.CurPos:=0;
NewSlide.MaxPos:=99;
Win[1].VertSlideBar(NewSlide); {Activate the slide bar}
NewSlide.X1:=12;
NewSlide.Y1:=19;
NewSlide.X2:=47;
NewSlide.Y2:=19; {More exciting information}
NewSlide.UpLeftChar:=#$1B;
NewSlide.DownRightChar:=#$1A;
Win[1].HorzSlideBar(NewSlide); {Setup the Horizontal Slide Bar}
Win[1].VertSlideIcon(True); {Turn the Slide Bars into Buttons}
Win[1].HorzSlideIcon(True);
{Okay, this part is done the 'easy' way. I could setup a linked list
of buttons and check for them but rather I'm going to add them to
each window.}
Win[1].Buttons.Add(2,2,2,2,False,#27); {Add the Close Application Button, [Esc]=#27}
WinBut[1][1]:=Win[1].Buttons.Number; {Remember the button number}
Win[1].Buttons.Add(0,0,0,0,False,#9); {0,0,0,0 for Key PressOnly, No Mouse Equivalent}
WinBut[1][2]:=Win[1].Buttons.Number; {These are allocated 'randomly'}
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
WinBut[1][3]:=Win[1].Buttons.Number;
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
WinBut[1][4]:=Win[1].Buttons.Number;
Win[1].Buttons.Add(0,0,0,0,Specia